package com.kunya.product.controller.portall;

import com.kunya.common.common.ServerResponse;
import com.kunya.common.util.CommonUtil;
import com.kunya.product.service.active.IProductRecommendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author WangGang
 * @Description: 推荐商品controller
 * @date 2018/7/7 14:50
 */
@RestController
@RequestMapping("/productRecommend")
public class ProductRecommendController {
    @Autowired
    private IProductRecommendService iproductRecommendService;
    /**
     * @Author WangGang
     * @Description 前台根据商品ID查找推荐商品的接口方法
     * @Date 16:26 2018/7/7
     **/
    @RequestMapping(value="/findByProductId",method = RequestMethod.GET)
    public ServerResponse findByProductId(Long productId, HttpServletRequest httpServletRequest){
        return iproductRecommendService.getProductRecoById(productId,"340_");
    }
    /**
     * @Author WangGang
     * @Description 根据推荐ID查询推荐商品
     * @Date 9:11 2018/7/9
     **/
    @RequestMapping(value="/getProductByRecommendId",method = RequestMethod.GET)
    public ServerResponse getProductByRecommendId(Long recommendId,HttpServletRequest httpServletRequest){
        return iproductRecommendService.getListByRecommendId(recommendId,"340_");
    }
}
